import Vue from 'vue'
import Router from 'vue-router'
const home = r => require.ensure([], () => r(require('@/view/home')), 'home');
const test = r => require.ensure([], () => r(require('@/view/test')), 'test');
const test2 = r => require.ensure([], () => r(require('@/view/test2')), 'test2');
Vue.use(Router)
let routes = [{ path: '/home', component: home }];
/* 权限路由：role: 0:角色1，1:角色2, nav: true可以渲染在导航栏 */
export const asyncRoutes = [{
    path: '/',
    component: home,
    redirect: '/home',
    meta: { role: ['0', '1'], nav: false },
    children: [{
            path: '/home/test',
            name: '测试',
            component: test,
            meta: { role: ['1'], nav: true }
        },
        {
            path: '/home/test2',
            name: '测试1',
            component: test2,
            meta: { role: ['0'], nav: true }
        },
    ]
}]
export default new Router({
    routes: routes
})